import { modal } from 'vue-strap'
import { showMsg, addHotPortfolio } from '../../../vuex/action'

export default {
  components: {
    'vue-modal': modal
  },
  vuex: {
    actions: {
      xShowMsg: showMsg,
      xAddPt: addHotPortfolio
    }
  },
  data() {
    return {
      showModal: false,
      form: {
        betaId: ''
      }
    }
  },
  methods: {
    submit() {
      if (!this.form.betaId) {
        return this.xShowMsg({
          type: 'danger',
          content: '* 标记的均为必填/必选项'
        })
      }
      this.xAddPt({
        betaId: +this.form.betaId
      })
        .then(() => {
          this.$els.addForm.reset()
          this.showModal = false
        })
        .catch((res) => {
          this.xShowMsg({
            type: 'danger',
            content: res.error_msg
          })
        })
    }
  }
}
